Skip to content

fix: peerDAS - Fix name of custody_group_count in Fulu metadata#7751

Merged
nflaig merged 3 commits intoChainSafe:peerDASfrom
dguenther:peerDAS-fix-cgc-name
Apr 29, 2025
Merged

fix: peerDAS - Fix name of custody_group_count in Fulu metadata#7751
nflaig merged 3 commits intoChainSafe:peerDASfrom
dguenther:peerDAS-fix-cgc-name

Conversation

@dguenther
Copy link
Copy Markdown
Contributor

Motivation

I was updating the beacon API to include custody group count when I noticed that the metadata field should be named custody_group_count, not cgc (unlike the ENR).

Description

  • Updated /eth/v1/node/identity to return Fulu metadata
  • Renamed cgc to custodyGroupCount in Metadata

@dguenther dguenther requested a review from a team as a code owner April 25, 2025 20:38
Copy link
Copy Markdown
Member

@nflaig nflaig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread packages/api/src/beacon/routes/node.ts Outdated
discoveryAddresses: ArrayOf(stringType),
/** Based on Ethereum Consensus [Metadata object](https://github.com/ethereum/consensus-specs/blob/v1.1.10/specs/phase0/p2p-interface.md#metadata) */
metadata: ssz.altair.Metadata,
metadata: ssz.fulu.Metadata,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a breaking change in a sense that if the beacon node does not return custody_group_count field we will throw an error... the problem here is the api design, usually we want a new version of the api if we add new fields, I hinted at this here ethereum/beacon-APIs#489 but since we did the same for altair I guess we are ok, I doubt anyone is using our api client to query this api and since we are merging this into peerDAS branch only for now I am fine with this, but let's keep an eye on this before we merge into unstable, ideally at this point all bns should return the field

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like this is already an issue in our sim tests because the Lighthouse version we run there doesn't support it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a better way to differentiate between the beacon-api types and the consensus-spec types when parsing them in those tests? It seems like the beacon API types are subtly different in that they don't require syncnets and custody_group_count, unlike the consensus-spec. I agree though that'd it'd definitely make it easier to match the types in both places

Copy link
Copy Markdown
Member

@nflaig nflaig Apr 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so the problem is that there is no ssz type to represent an optional field, even Optional in ssz means <type> | null, so if the field is omitted we always will have an issue

the alternative is to use ssz.altair.Metadata and handle custody_group_count outside of the ssz container, it's a bit hacky but I think we did this before somewhere, can try to find that

we usually try to use ssz containers but since the api can't support it anyways the hacky alternative would be fine

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a workaround, it's not pretty but should do the job for now

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 26, 2025

Codecov Report

Attention: Patch coverage is 54.05405% with 17 lines in your changes missing coverage. Please review.

Please upload report for BASE (peerDAS@6dfb4ec). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             peerDAS    #7751   +/-   ##
==========================================
  Coverage           ?   42.47%           
==========================================
  Files              ?      732           
  Lines              ?    52922           
  Branches           ?     2263           
==========================================
  Hits               ?    22481           
  Misses             ?    30399           
  Partials           ?       42           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@matthewkeil matthewkeil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EXCELLENT FIND!!!!

LGTM!!! 🥷

@nflaig nflaig merged commit ef7f4bd into ChainSafe:peerDAS Apr 29, 2025
16 of 17 checks passed
@dguenther dguenther deleted the peerDAS-fix-cgc-name branch April 29, 2025 17:43
@wemeetagain
Copy link
Copy Markdown
Member

🎉 This PR is included in v1.34.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants